from time import sleep


class PageEcshopBackHome():
    def __init__(self, driver):
        self.driver = driver

    def back_home_menu_frame(self):
        self.driver.switch_to.frame('menu-frame')

    def back_home_main_frame(self):
        self.driver.switch_to.frame('main-frame')

    def back_home_default_content(self):
        self.driver.switch_to.default_content()
        sleep(1)

    def back_home_first_choice(self, fxpath):
        self.driver.find_element(*fxpath).click()

    def back_home_second_choice(self, sxpath):
        self.driver.find_element(*sxpath).click()

    def back_home(self, fxpath, sxpath):
        self.back_home_menu_frame()
        self.back_home_first_choice(fxpath)
        self.back_home_second_choice(sxpath)
        self.back_home_default_content()
        self.back_home_main_frame()
